import 'dart:ui';
import 'dart:ui';

import 'package:flutter/material.dart';
import '../../utils/ColorUtil.dart';
import 'LineNav.dart';

class MiniTitleNav extends StatelessWidget{
  final String title;
  final bool showMore;
  final GestureTapCallback ? onTap;
  final bool  showLine;
  final double marginTop;
  final double marginLeft;
  const MiniTitleNav({super.key, required this.title, this.showMore = false,
    this.onTap ,this.showLine=true,this.marginTop = 16,
    this.marginLeft = 16});

   _showMoreWidget(){
    if(showMore){
      return const Row(
        children: [
          Text("更多"),
          Icon(Icons.arrow_right),
          SizedBox(width: 16,)
        ],
      );
    }
    return SizedBox();
  }

  //展示线条
  _showLine(){
     if(showLine){
       return lineNav.miniLine();
     } else {
       return SizedBox();
     }
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return GestureDetector(
      behavior: HitTestBehavior.translucent,
      onTap: onTap,
      child: Column(
        children: [
           SizedBox(height: marginTop,),
          Flex(
            direction: Axis.horizontal,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Row(
                children: [
                  Container(
                    height: 18,
                    margin:  EdgeInsets.fromLTRB(marginLeft, 0, 0, 0),
                    padding: const EdgeInsets.fromLTRB(0, 0, 8, 0),
                    decoration: BoxDecoration(
                        border: Border(
                            left: BorderSide(
                              color: ColorUtil.primaryBgColor,
                              width: 4,
                            )
                        )
                    ),
                  ),
                  Text( title, style: TextStyle(fontSize: 15,fontWeight: FontWeight.bold ),),

                ],
              ),
              _showMoreWidget()
            ],
          ),
          const SizedBox(height: 2,),
          _showLine(),
        ],
      ),
    );
  }



}

